<?
/**
 * PhpMailer Builder class
 * @package simplemailer
 * @author Alberto Pardo Saleme <apardo@gmail.com>
 * @update 22/08/2007 01:48:25 p.m.
 * Copyright (C) 2005 - AdVerit S.A. <www.adverit.com>
 */

class SimpleMailerEngine extends Error
{
    var $from    = '';
    var $to      = '';
    var $subject = '';
    var $body    = '';
    var $arAttachments = array();
    var $debug   = false;

    public function __construct() {}

    public function parseEmail($email)
    {
        $email = trim($email);
        if (!isRFC3696ValidEmailAddress($email))
        {
            preg_match("/^(.*)(\s)?<([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4}))>$/", $email, $out);
            return array(trim($out[3]), $out[1]);
        }
        else return array($email,'');
    }

    public function parseEmailsList($email)
    {
        $recipients = array();
        $email = str_replace(";",",",$email);
        $myRecipients = explode(",", $email);
        foreach($myRecipients AS $myRecipient)
        {
            array_push($recipients, $this->parseEmail($myRecipient));
        }
        return $recipients;
    }

    public function send()
    {
    }
}

?>
